<?php
include_once '../data/database_dal.php';

class AddressDAL extends DatabaseDAL
{
    function update($id, $userID, $name, $address1, $address2, $address3, $city, $country, $province, $zipCode, $inTime, $inUser)
    {
        $this->connect();
        $result = $this->mysqli->query("call pr_address_update('". $id ."', '". $userID ."', '". $name ."', '". $address1 ."', '". $address2 ."', '". $address3 ."', '". $city ."',
                                                      '". $country ."', '". $province ."', '". $zipCode ."', '". $inTime ."', '". $inUser ."')");
        $this->close();
        return $result;
    }

    function get($where)
    {
        $this->connect();
        return $this->mysqli->query("call pr_address_get(".'"'.$where.'"'.")");
        $this->close();
        return $result;
        
    }

    function getAll($orderBy)
    {
        $this->connect();
        $result = $this->mysqli->query("call pr_address_get(".'"'.$orderBy.'"'.")");
        $this->close();
        return $result;
    }

    function delete($id)
    {
        $this->connect();
        $result = $this->mysqli->query("call pr_address_delete('". $id ."')");
        $this->close();
        return $result;
    }

    function validate($id, $name)
    {
        $this->connect();
        $result = $this->mysqli->query("call pr_address_validate('". $id ."', '". $name ."')");
        $this->close();
        return $result;
    }
}

?>
